Skip to main content

SetTextFill

Sets the text fill to the current text run.

Syntax

expression.SetTextFill(oApiFill);

expression - A variable that represents a ApiTextPr class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oApiFillRequiredApiFillThe color or pattern used to fill the text color.

Returns

ApiTextPr

Example

In this example, the WordArt text has a text fill.

let doc = Api.GetDocument();
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
textPr.SetCaps(true);
textPr.SetOutLine(Api.CreateStroke(0.2 * 36000, Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51))));
textPr.SetTextFill(Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61)));
textPr.SetFontFamily("Comic Sans MS");
let textArt = Api.CreateWordArt(textPr, "onlyoffice", "textArchUp", null, null, 0, 150 * 36000, 50 * 36000);
let paragraph = doc.GetElement(0);
paragraph.AddDrawing(textArt);